import request from '@/utils/request'

// 查询线路站点关联，定义每条线路经过的站点及其顺序关系列表
export function listRouteStations(query) {
  return request({
    url: '/bus/route-stations/list',
    method: 'get',
    params: query
  })
}

// 查询线路站点关联，定义每条线路经过的站点及其顺序关系详细
export function getRouteStations(id) {
  return request({
    url: '/bus/route-stations/' + id,
    method: 'get'
  })
}

// 新增线路站点关联，定义每条线路经过的站点及其顺序关系
export function addRouteStations(data) {
  return request({
    url: '/bus/route-stations',
    method: 'post',
    data: data
  })
}

// 修改线路站点关联，定义每条线路经过的站点及其顺序关系
export function updateRouteStations(data) {
  return request({
    url: '/bus/route-stations',
    method: 'put',
    data: data
  })
}

// 删除线路站点关联，定义每条线路经过的站点及其顺序关系
export function delRouteStations(id) {
  return request({
    url: '/bus/route-stations/' + id,
    method: 'delete'
  })
}

// 根据线路ID删除所有站点关联
export function delRouteStationsByRouteId(routeId) {
  return request({
    url: '/bus/route-stations/route/' + routeId,
    method: 'delete'
  })
}

// 批量保存线路站点关联
export function batchSaveRouteStations(routeId, stationsList) {
  return request({
    url: '/bus/route-stations/batch/' + routeId,
    method: 'post',
    data: stationsList
  })
}